﻿using System;
using System.Collections.Generic;
using System.Text;
using CTEM.Controllers.Global;
using CTEM.Controllers.Global;

namespace CTEM.Models
{
    /// <summary>
    /// 
    /// </summary>
    public class CT_MaterialDTO
    {
        public long MaterialID { get; set; }
        public string MaterialName { get; set; }
        public string Unit { get; set; }
        public long LastPrice { get; set; }
        public bool IsActive { get; set; }
        public bool IsDelete { get; set; }
        public string CreatedBy { get; set; }
        public DateTime CreatedDate { get; set; }
        public string UpdatedBy { get; set; }
        public DateTime LastUpdated { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public HistoryLevel History { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public CT_MaterialDTO()
        {
            MaterialID = 0;
            MaterialName = Constants.EMPTY_TEXT;
            Unit = Constants.EMPTY_TEXT;
            LastPrice = 0;
            IsActive = true;
            IsDelete = false;
            CreatedBy = Global.CurrentUser.Username;
            CreatedDate = DateTime.Today;
            UpdatedBy = Global.CurrentUser.Username;
            LastUpdated = DateTime.Today;
        }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(CT_MaterialDTO)) return false;
            return Equals((CT_MaterialDTO)obj);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(CT_MaterialDTO other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.MaterialID, MaterialID);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static bool operator ==(CT_MaterialDTO left, CT_MaterialDTO right)
        {
            return Equals(left, right);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static bool operator !=(CT_MaterialDTO left, CT_MaterialDTO right)
        {
            return !Equals(left, right);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        
    }
}
